package org.example.product.service.impl;

import org.example.product.entity.ResultBody;
import org.example.product.mapper.OrderManMapper;
import org.example.product.service.OrderManService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderManServiceimpl implements OrderManService {
    @Autowired
    private OrderManMapper orderManMapper;
    @Override
    public int DeOrder(String code)
    {
        if(orderManMapper.DeOder(code)>0)
        {
            return 1;
        }
        return 0;
    }
    @Override
    public ResultBody displayOrder()
    {
        if(!orderManMapper.displayOrder().isEmpty())
        {
            return new ResultBody(200,"查询成功",orderManMapper.displayOrder(),orderManMapper.displayOrder().size());
        }
        else
            return new ResultBody(400,"查询失败",false);
    }
    @Override
    public ResultBody displayOrderDetailed(String phone, String code)
    {
        if(!orderManMapper.displayOrderDetailed(phone,code).isEmpty())
        {
            return new ResultBody(200,"查询成功",orderManMapper.displayOrderDetailed(phone,code),orderManMapper.displayOrderDetailed(phone,code).size());
        }
        else
            return new ResultBody(400,"查询失败",false);
    }


}
